<script setup lang="ts">
import { ref } from 'vue'

defineProps({
  modelValue: Boolean
})
const emit = defineEmits(['update:modelValue', 'close', 'submit'])

const form = ref({
  url: '',
  username: '',
  email: ''
})

function handleClose() {
  emit('update:modelValue', false)
  emit('close')
}

function onSubmit() {
  emit('submit', form.value)
  handleClose()
}
</script>
<template>
  <el-dialog
    :modal="false"
    :show-close="false"
    :model-value="modelValue"
    title="创建同步文件夹"
    append-to-body
    width="400"
  >
    <el-form :model="form" label-width="80px">
      <el-form-item label="远程仓库:">
        <el-input v-model="form.url" placeholder="https://xxxx/xxx/xxx.git" />
      </el-form-item>
      <el-form-item label="用户名:">
        <el-input v-model="form.username" placeholder="username" />
      </el-form-item>
      <el-form-item label="邮箱:">
        <el-input v-model="form.email" placeholder="email" />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="onSubmit">确认</el-button>
        <el-button @click="handleClose">取消</el-button>
      </el-form-item>
    </el-form>
  </el-dialog>
</template>
